package com.example.myapplication;

import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.Reader;
import java.io.UnsupportedEncodingException;

/**
 * Created by Yi on 13-9-4.
 */
public class StrUtil {
    public static String readFromStream(InputStream stream) throws IOException {
        Reader reader;
        StringBuffer strBuf= new StringBuffer();

        reader = new InputStreamReader(stream, "UTF-8");

        int c;
        while ((c = reader.read())!= -1){
            strBuf.append((char)c);
        }

        stream.close();
        return strBuf.toString();
    }
}
